#ifndef CUSTOMEVENT_H
#define CUSTOMEVENT_H

#include <QEvent>
#include <QString>

// 注册自定义事件类型
#define CSTM_EVENT_BASE                   static_cast<QEvent::Type>((QEvent::User + 1))
#define CSTM_EVENT_MODBUS_SEND            static_cast<QEvent::Type>((QEvent::User + 2))
#define CSTM_EVENT_MODBUS_RECV            static_cast<QEvent::Type>((QEvent::User + 3))

class CustomEvent : public QEvent
{
public:
    CustomEvent();
    ~CustomEvent();
};

class ModbusSendEvent : public QEvent
{
public:
    ModbusSendEvent(const QByteArray& data);
    ~ModbusSendEvent();
    QByteArray data();

private:
    QByteArray _data;
};

class ModbusRecvEvent : public QEvent
{
public:
    ModbusRecvEvent(const QByteArray& data);
    ~ModbusRecvEvent();
    QByteArray data();

private:
    QByteArray _data;
};

#endif // CUSTOMEVENT_H
